package cn.bocweb.spinning.model.Bean;

import android.content.Context;
import android.content.SharedPreferences;

import cn.bocweb.spinning.util.Constant;

/**
 * Created by chenchangxing on 16/1/9.
 */
public class FindPwdBean {
    private String msg;
    private int return_code;
    private DataEntity data;

    public DataEntity getData() {
        return data;
    }

    public void setData(DataEntity data) {
        this.data = data;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public void setReturn_code(int return_code) {
        this.return_code = return_code;
    }

    public String getMsg() {
        return msg;
    }

    public int getReturn_code() {
        return return_code;
    }

    public static class DataEntity {
        private String nickname;
        private String realname;
        private String company;
        private String position;
        private String tel;
        private String gender;
        private String address;
        private String code;
        private String uthumb;
        private String phone;
        private String userid;

        public void setNickname(String nickname) {
            this.nickname = nickname;
        }

        public void setRealname(String realname) {
            this.realname = realname;
        }

        public void setCompany(String company) {
            this.company = company;
        }

        public void setPosition(String position) {
            this.position = position;
        }

        public void setTel(String tel) {
            this.tel = tel;
        }

        public void setGender(String gender) {
            this.gender = gender;
        }

        public void setAddress(String address) {
            this.address = address;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public void setUthumb(String uthumb) {
            this.uthumb = uthumb;
        }

        public void setPhone(String phone) {
            this.phone = phone;
        }

        public void setUserid(String userid) {
            this.userid = userid;
        }

        public String getNickname() {
            return nickname;
        }

        public String getRealname() {
            return realname;
        }

        public String getCompany() {
            return company;
        }

        public String getPosition() {
            return position;
        }

        public String getTel() {
            return tel;
        }

        public String getGender() {
            return gender;
        }

        public String getAddress() {
            return address;
        }

        public String getCode() {
            return code;
        }

        public String getUthumb() {
            return uthumb;
        }

        public String getPhone() {
            return phone;
        }

        public String getUserid() {
            return userid;
        }

        public void writeInfoIntoLocal(Context context) {
            SharedPreferences sp = context.getSharedPreferences(Constant.USER_INFO, Context.MODE_PRIVATE);
            SharedPreferences.Editor editor = sp.edit();
            editor.putString("nickname", nickname);
            editor.putString("realname", realname);
            editor.putString("company", company);
            editor.putString("position", position);
            editor.putString("tel", tel);
            editor.putString("gender", gender);
            editor.putString("address", address);
            editor.putString("code", code);
            editor.putString("uthumb", uthumb);
            editor.putString("phone", phone);
            editor.putString("userid", userid);
            editor.commit();
        }

        public void readInfoFromLocal(Context context) {
            SharedPreferences sp = context.getSharedPreferences(Constant.USER_INFO, Context.MODE_PRIVATE);
            this.nickname = sp.getString("nickname", "");
            this.realname = sp.getString("realname", "");
            this.company = sp.getString("company", "");
            this.position = sp.getString("position", "");
            this.tel = sp.getString("tel", "");
            this.gender = sp.getString("gender", "");
            this.address = sp.getString("address", "");
            this.code = sp.getString("code", "");
            this.uthumb = sp.getString("uthumb", "");
            this.phone = sp.getString("phone", "");
            this.userid = sp.getString("userid", "");
        }
        public void clearInfoFromLocal(Context context) {
            SharedPreferences sp = context.getSharedPreferences(Constant.USER_INFO, Context.MODE_PRIVATE);
            SharedPreferences.Editor editor = sp.edit();
            editor.putString("realname", "");
            editor.putString("company", "");
            editor.putString("position", "");
            editor.putString("tel", "");
            editor.putString("gender", "");
            editor.putString("address", "");
            editor.putString("code", "");
            editor.putString("phone", "");
            editor.putString("userid", "");
            editor.commit();
        }

    }
}
